package com.lmx.repoDomain.tmodel;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToMany;
import io.katharsis.resource.annotations.JsonApiToOne;
/**
 * 医疗支付的方式表
 * @author jing
 *
 */
@JsonApiResource(type = "medicalpaymentmode")
@Table(name = "tnb_medical_paymentmode")
@Entity
public class MedicalPaymentMode extends BaseEntity {

//	private List<Dicttype> medicalInsuranceType = new ArrayList<Dicttype>();  //医疗方式支付的类型选择
	
	private Dicttype medicalInsuranceType = new Dicttype(); //医疗方式支付的类型选择 
	
	private HealthRecord healthrecord; //对应的健康档案表
	
	private String remark; //备注
	
	
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "medical_paytype_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getMedicalInsuranceType() {
		return medicalInsuranceType;
	}     

	public void setMedicalInsuranceType(Dicttype medicalInsuranceType) {
		this.medicalInsuranceType = medicalInsuranceType;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "health_record_id", nullable = true, foreignKey = @ForeignKey(name = "null"))
	public HealthRecord getHealthrecord() {
		return healthrecord;
	}

	public void setHealthrecord(HealthRecord healthrecord) {
		this.healthrecord = healthrecord;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	
}
